import Vue from "vue";
import VueRouter from "vue-router";
import Login from "../views/login/login.vue"
import Layout from "../components/Layout.vue"
import Home from "../views/Home.vue"
import Member from "../views/Member.vue"
import Supplier from "../views/Supplier.vue"
import Goods from "../views/Goods.vue"
import Staff from "../views/Staff.vue"
Vue.use(VueRouter);

const router = new VueRouter({
  routes: [
    {
      //跳转登陆页面路由
      name: "login",
      path: "/login",
      component: Login
    },
    {
      //首页布局
      name:"layout",
      path:"/",
      component: Layout,
      redirect:"/home",
      children:[
        {
          path:"/home",
          component:Home,
          meta:{title:"首页"}
        }
      ]
    },
    {
      path:"/member",
      component:Layout,
      children:[
        {
          path:"/member/",
          component:Member,
          meta:{title:"会员管理"},
        }
      ]
    },
    {
      path:"/supplier",
      component:Layout,
      children:[
        {
          path:"/supplier/",
          component:Supplier,
          meta:{title:"供应商管理"},
        }
      ]
    },
    {
      path:"/goods",
      component:Layout,
      children:[
        {
          path:"/goods/",
          component:Goods,
          meta:{title:"商品管理"},
        }
      ]
    },
    {
      path:"/staff",
      component:Layout,
      children:[
        {
          path:"/staff/",
          component:Staff,
          meta:{title:"员工管理"},
        }
      ]
    }
  ]
});

export default router;
